package com.liumuxian.video.dao;

import com.liumuxian.video.pojo.Templateset;
import org.springframework.data.jpa.repository.*;
import java.util.*;

public interface TemplatesetDao extends JpaRepository<Templateset,String>, JpaSpecificationExecutor<Templateset> {
    /**
     * 多表查询
     * @return
     */
    @Query(value = "SELECT v.*,t.* FROM tb_video v,tb_templateset t,tb_videotemplateset vt WHERE  v.id = vt.videoid AND t.id = vt.templatesetid AND t.id=?1",nativeQuery = true)
    List<Templateset> findByTemAndVideo(String tid);
    @Modifying
    @Query(value = "update tb_templateset set pid=?1,name=?2,type=?3,visits=?4,istop=?5,state=?6,weight=?7,creatdata=?8,updatedate=?9 where id=?10",nativeQuery = true)
    void update(String pid,String name,String type,Integer visits,String istop,Integer state,Integer weight,Date creatdata, Date updatedate, String rid);
    List<Templateset> findAllByState(Integer state);
}
